home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / scorched.swf / scripts / frame_116 / DoAction_15.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  2.9 KB  |  152 lines

  1. function movebomb()
  2. {
  3.    if(lastbx == undefined)
  4.    {
  5.       obx = bx;
  6.       oby = by;
  7.    }
  8.    else
  9.    {
  10.       obx = lastbx;
  11.       oby = lastby;
  12.    }
  13.    bombtrailcount++;
  14.    if(bombtrailcount > bombtraildelay)
  15.    {
  16.       bombtrailcount = 0;
  17.       attachMovie("bombtrail","b" + bombt,bombt);
  18.       bombt++;
  19.       if(bombt > 500)
  20.       {
  21.          bombt = 400;
  22.       }
  23.    }
  24.    if(by < 0)
  25.    {
  26.       this.misslefollow._x = bx;
  27.    }
  28.    else
  29.    {
  30.       this.misslefollow._x = -10;
  31.    }
  32.    temppower -= gravity;
  33.    upv = temppower * Math.sin(radian);
  34.    if(rightv > 0)
  35.    {
  36.       rightv += windamount;
  37.       if(rightv < 0)
  38.       {
  39.          leftv = Math.abs(rightv);
  40.          rightv = 0;
  41.       }
  42.    }
  43.    if(leftv > 0)
  44.    {
  45.       leftv -= windamount;
  46.       if(leftv < 0)
  47.       {
  48.          rightv = Math.abs(leftv);
  49.          leftv = 0;
  50.       }
  51.    }
  52.    bx += rightv;
  53.    bx -= leftv;
  54.    by += upv;
  55.    if(upv == 0)
  56.    {
  57.       upv += 5;
  58.    }
  59.    if(bx > 800)
  60.    {
  61.       bx = 800;
  62.       leftv = rightv;
  63.       rightv = 0;
  64.    }
  65.    if(bx < 0)
  66.    {
  67.       bx = 0;
  68.       rightv = leftv;
  69.       leftv = 0;
  70.    }
  71.    if(by > 600)
  72.    {
  73.       by = 600;
  74.       hity = by;
  75.       lastbx = undefined;
  76.       action = "explode bomb";
  77.    }
  78.    hitarraynum = Math.floor(bx / landdetail);
  79.    hitloc = landarray[hitarraynum];
  80.    if(by >= hitloc)
  81.    {
  82.       hitx = hitarraynum * landdetail;
  83.       hity = hitloc;
  84.       action = "explode bomb";
  85.    }
  86.    if(turn == "player2")
  87.    {
  88.       a = Math.abs(p1x - bx);
  89.       b = Math.abs(p1y - by);
  90.       if(a < 30 && b < 30)
  91.       {
  92.          if(player1shield > 1)
  93.          {
  94.             player1shield--;
  95.             if(explosiontype == 4)
  96.             {
  97.                player1shield = 1;
  98.             }
  99.             shieldfadesound.start();
  100.          }
  101.          else
  102.          {
  103.             player1health -= bombforce;
  104.          }
  105.          hitx = bx;
  106.          hity = by;
  107.          explodesteps = 10;
  108.          moveblast = bombforce / explodesteps;
  109.          blaststeps = moveblast;
  110.          moveblast += blaststeps;
  111.          explodealpha = 100;
  112.          action = "explode bomb";
  113.       }
  114.    }
  115.    else
  116.    {
  117.       a = Math.abs(p2x - bx);
  118.       b = Math.abs(p2y - by);
  119.       if(a < 30 && b < 30)
  120.       {
  121.          if(player2shield > 1)
  122.          {
  123.             player2shield--;
  124.             if(explosiontype == 4)
  125.             {
  126.                player2shield = 1;
  127.             }
  128.             shieldfadesound.start();
  129.          }
  130.          else
  131.          {
  132.             player2health -= bombforce;
  133.          }
  134.          hitx = bx;
  135.          hity = by;
  136.          explodesteps = 10;
  137.          moveblast = bombforce / explodesteps;
  138.          blaststeps = moveblast;
  139.          moveblast += blaststeps;
  140.          explodealpha = 100;
  141.          action = "explode bomb";
  142.       }
  143.    }
  144.    bomb._x = bx;
  145.    bomb._y = by;
  146.    lastbx = bx;
  147.    lastby = by;
  148. }
  149. bombt = 400;
  150. bombtraildelay = 2;
  151. bombtrailcount = 0;
  152.